home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_exmh.idb / usr / freeware / lib / exmh-2.5 / pgpBase.tcl.z / pgpBase.tcl
Text File  |  2002-07-08  |  7KB  |  210 lines

  1. # pgpBase.tcl
  2.  
  3. #
  4. # This file contains basic variables and procedures needed
  5. # for the initialisation process
  6. #
  7.  
  8. # $Log: pgpBase.tcl,v $
  9. # Revision 1.7  2001/05/18 22:54:22  bmah
  10. # Made the PGP detection code actually try to execute a program
  11. # (e.g. "gpg --version") and parse the output to determine the presence
  12. # of installed PGP versions.  Formerly, only the existence of files
  13. # was checked.
  14. #
  15. # For the most part, there shouldn't be any change, but this makes it easier
  16. # to support PGP6 under FreeBSD (the FreeBSD Ports Collection installs PGP
  17. # as /usr/local/bin/pgp).
  18. #
  19. # Revision 1.6  2000/06/16 18:16:26  valdis
  20. # Various PGP fixes...
  21. #
  22. # Revision 1.5  2000/06/09 03:46:25  valdis
  23. # PGP 6.5 support
  24. #
  25. # Revision 1.4  1999/08/24 15:51:07  bmah
  26. # Patch from Kevin Christian to make email PGP key queries work, and
  27. # to make key attachment RFC 2015 compliant.
  28. #
  29. # Revision 1.3  1999/08/22 18:17:08  bmah
  30. # Email PGP queries now go out correctly.  Use Exmh_Status to inform
  31. # user of state of an outgoing email key query.
  32. #
  33. # Revision 1.2  1999/08/03 04:05:54  bmah
  34. # Merge support for PGP2/PGP5/GPG from multipgp branch.
  35. #
  36. # Revision 1.1.4.3  1999/07/18 12:52:04  gruber
  37. # *** empty log message ***
  38. #
  39. # Revision 1.1.4.2  1999/07/09 12:36:10  gruber
  40. # few fixes
  41. #
  42. # Revision 1.1.4.1  1999/06/14 20:05:14  gruber
  43. # updated multipgp interface
  44. #
  45. # Revision 1.1  1999/06/14 15:14:53  markus
  46. # added files
  47. #
  48.  
  49. proc Pgp_Base_Init {} {
  50. global pgp miscRE env
  51. ###
  52.  
  53. # ---- For all versions ---- #
  54. set miscRE(headerend) {^(--+.*--+)?$}
  55. set miscRE(mimeheaders) {^content-[-a-z]+:}
  56. set miscRE(true) {^(on|y(es)?|t(rue)?)$}
  57. set miscRE(beginpgp) {^-+BEGIN PGP}
  58. set miscRE(beginpgpkeys) {^-+BEGIN PGP PUBLIC KEY BLOCK-+$}
  59. set miscRE(beginpgpclear) {^-+BEGIN PGP SIGNED MESSAGE-+$}
  60.  
  61. set pgp(enabled) 0
  62. set pgp(pat_MenuInner) {Pgp}
  63.  
  64. set pgp(supportedversions) [list pgp pgp5 gpg pgp6]
  65.  
  66. # -- GnuPG -- #
  67. set pgp(gpg,enabled) 0
  68. set pgp(gpg,fullName) "GnuPG"
  69.  
  70. set pgp(gpg,executable,key) gpg
  71. set pgp(gpg,executable,verify) gpg
  72. set pgp(gpg,executable,encrypt) gpg
  73. set pgp(gpg,executable,sign) gpg
  74. set pgp(gpg,executable,version) gpg
  75. set pgp(gpg,executable,versionflags) "--version"
  76. set pgp(gpg,executable,versionregexp) "^gpg"
  77.  
  78. if [info exists env(GNUPGHOME)] {
  79.     set pgp(gpg,defaultPath) "$env(GNUPGHOME)"
  80. } else {
  81.     set pgp(gpg,defaultPath) "$env(HOME)/.gnupg"
  82. }
  83.  
  84. set pgp(gpg,configFile) "$pgp(gpg,defaultPath)/options"
  85. set pgp(gpg,pubring) "$pgp(gpg,defaultPath)/pubring.gpg"
  86. set pgp(gpg,secring) "$pgp(gpg,defaultPath)/secring.gpg"
  87. set pgp(gpg,pubringBkp) "$pgp(gpg,defaultPath)/pubring.gpg~"
  88. set pgp(gpg,keyGenCmd) "rm -f $pgp(gpg,pubringBkp) && gpg --gen-key"
  89. set pgp(gpg,ownPattern) ""
  90.  
  91. ## ButtonMenuInner
  92. set pgp(gpg,pat_MenuInner) {GPG}
  93. ## Version checking and Compatibilty
  94. set pgp(gpg,pat_Version) "Version:\[ \t\]*(GNUPG|GnuPG).*"
  95. set pgp(gpg,list_Alien) {pgp5 pgp6 pgp}
  96.  
  97.  
  98. # -- PGP 2.6 -- #
  99. set pgp(pgp,enabled) 0
  100. set pgp(pgp,fullName) "PGP 2.6"
  101.  
  102. set pgp(pgp,executable,key) pgp
  103. set pgp(pgp,executable,verify) pgp
  104. set pgp(pgp,executable,encrypt) pgp
  105. set pgp(pgp,executable,sign) pgp
  106. set pgp(pgp,executable,version) pgp
  107. set pgp(pgp,executable,versionflags) "-v"
  108. set pgp(pgp,executable,versionregexp) "^Pretty Good Privacy.* 2\."
  109.  
  110. if [info exists env(PGPPATH)] {
  111.     set pgp(pgp,defaultPath) "$env(PGPPATH)"
  112. } else {
  113.     set pgp(pgp,defaultPath) "$env(HOME)/.pgp"
  114. }
  115. set pgp(pgp,configFile) "$pgp(pgp,defaultPath)/config.txt"
  116. set pgp(pgp,pubring) "$pgp(pgp,defaultPath)/pubring.pgp"
  117. set pgp(pgp,secring) "$pgp(pgp,defaultPath)/secring.pgp"
  118. set pgp(pgp,pubringBkp) "$pgp(pgp,defaultPath)/pubring.bak"
  119. set pgp(pgp,keyGenCmd) "rm -f $pgp(pgp,pubringBkp) && pgp -kg"
  120. set pgp(pgp,afterKeyGen) {
  121.     if {![file exists pgp(pgp,pubringBkp)]} {
  122.         return
  123.     } else {
  124.         set tmpfile [Mime_TempFile "pgp"]
  125.         Exec_GetKeys pgp \
  126.                [lindex [lindex $pgp(pgp,privatekeys) 0] 0] $tmpfile
  127.         Pgp_Misc_Send $pgp(pgp,keyserver) ADD $tmpfile \
  128.                "content-type: application/pgp; format=keys-only"
  129.         File_Delete $tmpfile
  130.     }
  131. }
  132. set pgp(pgp,ownPattern) ""
  133.  
  134. ## ButtonMenuInner
  135. set pgp(pgp,pat_MenuInner) {PGP[^5]}
  136. ## Version checking and Compatibilty
  137. set pgp(pgp,pat_Version) "Version:\[ \t\]*2\.6.*"
  138. set pgp(pgp,list_Alien) {pgp5 pgp6 gpg}
  139.  
  140. # -- PGP 5.0 -- #
  141. set pgp(pgp5,enabled) 0
  142. set pgp(pgp5,fullName) "PGP 5.0"
  143. set pgp(pgp5,executable,key) pgpk
  144. set pgp(pgp5,executable,verify) pgpv
  145. set pgp(pgp5,executable,encrypt) pgpe
  146. set pgp(pgp5,executable,sign) pgps
  147. set pgp(pgp5,executable,version) pgpv
  148. set pgp(pgp5,executable,versionflags) "--version"
  149. set pgp(pgp5,executable,versionregexp) "^PGP.* unix5"
  150.  
  151. set pgp(pgp5,defaultPath) "$pgp(pgp,defaultPath)"
  152. set pgp(pgp5,configFile) "$pgp(pgp5,defaultPath)/pgp.cfg"
  153. set pgp(pgp5,pubring) "$pgp(pgp5,defaultPath)/pubring.pkr"
  154. set pgp(pgp5,secring) "$pgp(pgp5,defaultPath)/secring.skr"
  155. set pgp(pgp5,pubringBkp) "$pgp(pgp5,defaultPath)/pubring.bak"
  156. set pgp(pgp5,keyGenCmd) "rm -f $pgp(pgp5,pubringBkp) && pgpk -g"
  157. set pgp(pgp5,ownPattern) ""
  158.  
  159. ## ButtonMenuInner
  160. set pgp(pgp5,pat_MenuInner) {PGP5}
  161. ## Version checking and Compatibilty
  162. set pgp(pgp5,pat_Version) "Version:\[ \t\]*((PGP\[^\n\]*)? 5\\.|PGPsdk).*"
  163. set pgp(pgp5,list_Alien) {gpg pgp pgp6}
  164.  
  165. # -- PGP 6.5.n -- #
  166. set pgp(pgp6,enabled) 0
  167. set pgp(pgp6,fullName) "PGP 6.5"
  168.  
  169. set pgp(pgp6,executable,key) pgp6
  170. set pgp(pgp6,executable,verify) pgp6
  171. set pgp(pgp6,executable,encrypt) pgp6
  172. set pgp(pgp6,executable,sign) pgp6
  173. set pgp(pgp6,executable,version) pgp6
  174. set pgp(pgp6,executable,versionflags) "-v"
  175. set pgp(pgp6,executable,versionregexp) "^Pretty Good Privacy.* 6"
  176.  
  177. if [info exists env(PGPPATH)] {
  178.     set pgp(pgp6,defaultPath) "$env(PGPPATH)"
  179. } else {
  180.     set pgp(pgp6,defaultPath) "$env(HOME)/.pgp"
  181. }
  182. set pgp(pgp6,configFile) "$pgp(pgp6,defaultPath)/config.txt"
  183. set pgp(pgp6,pubring) "$pgp(pgp6,defaultPath)/pubring.pkr"
  184. set pgp(pgp6,secring) "$pgp(pgp6,defaultPath)/secring.skr"
  185. set pgp(pgp6,pubringBkp) "$pgp(pgp6,defaultPath)/pubring-bak-1.pkr"
  186. set pgp(pgp6,keyGenCmd) "rm -f $pgp(pgp6,pubringBkp) && pgp6 -kg"
  187. set pgp(pgp6,afterKeyGen) {
  188.     if {![file exists pgp(pgp6,pubringBkp)]} {
  189.         return
  190.     } else {
  191.         set tmpfile [Mime_TempFile "pgp"]
  192.         Exec_GetKeys pgp \
  193.                [lindex [lindex $pgp(pgp6,privatekeys) 0] 0] $tmpfile
  194.         Pgp_Misc_Send $pgp(pgp6,keyserver) ADD $tmpfile \
  195.                "content-type: application/pgp; format=keys-only"
  196.         File_Delete $tmpfile
  197.     }
  198. }
  199. # this is somewhat bogus, but seems to work...
  200. set pgp(pgp6,ownPattern) "."
  201.  
  202. ## ButtonMenuInner
  203. set pgp(pgp6,pat_MenuInner) {PGP6}
  204. ## Version checking and Compatibilty
  205. set pgp(pgp6,pat_Version) "Version:\[ \t\]*6\.5.*"
  206. set pgp(pgp6,list_Alien) {pgp pgp5 gpg}
  207.  
  208. ###
  209. }
  210.